package cn.JHai.dao;
import cn.JHai.domain.Music;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

public interface MusicDao {

	@Insert("insert into favorite (name,singer,album,gender,time,src,info,uid) values (#{name},#{singer},#{album},#{gender},#{time},#{src},#{info},#{uid})")
	public boolean insert(Music music) ;

	@Select("select * from favorite")
	public ArrayList<Music> findAll() ;

	@Select("select * from favorite  where id=#{mid} ")
	public Music find(String mid) ;

	@Select("SELECT  *  FROM  favorite  WHERE  name like CONCAT('%',#{name},'%') ")
	public ArrayList<Music> findmusic(String name) ;

	@Delete("delete from favorite where id=#{mid} ")
	public boolean delete(int id);

	@Update("update favorite set name=#{name},singer=#{album},gender=#{gender},time=#{favorite},src=#{src},info=#{info},uid=#{uid} where mid=#{mid}")
	public boolean update(Music music) ;
	}
